package com.sdk.sdkspringbootstarter;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnProperty(prefix = "sdk", name = "enabled", havingValue = "true")
@ComponentScan("com.sdk.sdkspringbootstarter")
public class SdkAutoConfiguration {
    private final SdkProperties properties;

    public SdkAutoConfiguration(SdkProperties properties) {
        this.properties = properties;
    }

    @Bean
    @ConditionalOnMissingBean
    public SdkService yourService() {
        return new SdkService(properties);
    }
}